package tests;

import common.Utils;
import org.openqa.selenium.By;

public class NoLogin extends Utils {
    public static String listurl = "http://139.196.34.232:8080/blog_list.html";
    public static String editurl = "http://139.196.34.232:8080/blog_edit.html";
    public static String detailurl = "http://139.196.34.232:8080/blog_detail.html?blogId=5";

    public NoLogin() {
        //这里直接传空字符串的话会报参数错误, 先直接到登录页将就一下
        super("http://139.196.34.232:8080/blog_login.html");
    }

    //未登录状态, 会跳转到登录页面
    public void ListPageByNoLogin() throws InterruptedException {
        //1.直接跳转到网址
        //2.检查是否在登录页面
        driver.get(listurl);
        driver.findElement(By.cssSelector("body > div.container-login > div > h3"));
        driver.findElement(By.cssSelector("body > div.container-login > div > div:nth-child(2) > span"));
        driver.findElement(By.cssSelector("body > div.container-login > div > div:nth-child(3) > span"));
    }

//    public void EditPageByNoLogin() throws InterruptedException {
//        //1.直接跳转到网址
//        //2.检查是否在登录页面
//        driver.get(editurl);
//        driver.findElement(By.cssSelector("body > div.container-login > div > h3"));
//        driver.findElement(By.cssSelector("body > div.container-login > div > div:nth-child(2) > span"));
//        driver.findElement(By.cssSelector("body > div.container-login > div > div:nth-child(3) > span"));
//    }

    public void DetailPageByNoLogin() throws InterruptedException {
        //1.直接跳转到网址
        //2.检查是否在登录页面
        driver.get(detailurl);
        driver.findElement(By.cssSelector("body > div.container-login > div > h3"));
        driver.findElement(By.cssSelector("body > div.container-login > div > div:nth-child(2) > span"));
        driver.findElement(By.cssSelector("body > div.container-login > div > div:nth-child(3) > span"));
    }
}
